#include "ufxconfig.h"

UFXConfig::UFXConfig(){
    QString IniFilePath="Config.ini";
    m_conf = new QSettings(IniFilePath,QSettings::IniFormat);
    m_conf->setIniCodec("UTF8");
}
UFXConfig::~UFXConfig(){
    delete m_conf;
}

QString UFXConfig::GetString(const char *szSection, const char *szEntry, const char *szValue){
    m_mutex.lock();
    QString key = QString(szSection) + "/" + QString(szEntry);
    QString value = m_conf->value(key,"").toString();
    m_mutex.unlock();
    return value;
}
void UFXConfig::SetString(const char *szSection, const char *szEntry, const char *szValue){
    m_mutex.lock();
    QString key = QString(szSection) + "/" + QString(szEntry);
    m_conf->setValue(key,QString(szValue));
    m_mutex.unlock();
}

UFXConfig* UFXConfig::getInstance(){
    return instance;
}

UFXConfig::UFXConfig(const UFXConfig&){

}
UFXConfig& UFXConfig::operator=(const UFXConfig&){
    return *instance;
}




